﻿<UserControl x:Class="SoftTeach.View.Datenbank.KlassenstufeDetailView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
             mc:Ignorable="d" 
             d:DesignHeight="238" d:DesignWidth="287">
  <UserControl.Resources>
    <CollectionViewSource Source="{Binding Path=Klassen}" x:Key="KlassenSorted">
      <CollectionViewSource.SortDescriptions>
        <scm:SortDescription PropertyName="KlasseBezeichnung"/>
      </CollectionViewSource.SortDescriptions>
    </CollectionViewSource>
  </UserControl.Resources>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <StackPanel Grid.Row="0" Orientation="Vertical">
      <Label Content="Lerngruppen der Klassenstufe"/>
      <StackPanel Orientation="Horizontal">
        <Button Name="AddButton" Command="{Binding Path=AddKlasseCommand}"
                                   Style="{Binding Source={StaticResource {x:Static ToolBar.ButtonStyleKey}}}">
          <StackPanel Orientation="Horizontal">
            <Grid>
              <Image Source="/SoftTeach;component/Images/Klasse32.png"/>
              <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
            </Grid>
          </StackPanel>
        </Button>
        <Label></Label>
        <Button Name="RemoveButton" 
                            Command="{Binding Path=DeleteKlasseCommand}"
                                   Style="{Binding Source={StaticResource {x:Static ToolBar.ButtonStyleKey}}}">
          <StackPanel Orientation="Horizontal">
            <Grid>
              <Image Source="/SoftTeach;component/Images/Klasse32.png"/>
              <Image Source="/SoftTeach;component/Images/RemoveOverlay32.png"/>
            </Grid>
          </StackPanel>
        </Button>
      </StackPanel>
    </StackPanel>
    <DataGrid Grid.Row="1" Margin="3" SelectedItem="{Binding Path=CurrentKlasse, Mode=TwoWay}" ItemsSource="{Binding Source={StaticResource KlassenSorted}}" AutoGenerateColumns="False">
      <DataGrid.Columns>
        <DataGridTextColumn Header="Lerngruppen" Binding="{Binding Path=KlasseBezeichnung}" Width="*"/>
      </DataGrid.Columns>
    </DataGrid>
  </Grid>
</UserControl>
